Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

140
Vistas
Is there a way in JS / React to execute code if input[type="file"] has a file uploaded

i want to execute some code only if user has clicked on "add file" (when we use an input type file in html) and selected a file. Is there a way to do this ?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Yes, you can work with the input event like this:

const input = document.querySelector('input');

input.addEventListener('input', updateValue);

function updateValue(e) {
  log.textContent = e.target.value;
}

You can of course modify this to suit your requirement. This example is from the Mozilla documentation here

Take a look at this answer which you may also find useful. It works with the change event.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda